<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<div id="tabs">
    <ul>
        <li id="t1"><a href="#tabs-1">许可证导入</a>
        </li>
    </ul>

    <div id="tabs-1">
        <div class="content-box-content">
            <div id="tab2">
            	<p class="validateTips"></p>
                <form method="post" action="${ctx}/license/register" id="licenseForm">
                    <input type="hidden" name="s_totalCount" value="${map.totalCount}"/>
                    <table class="searchtable">
                        <tbody>
	                        <tr>
	                            <td class="bg_gray">当前许可证有效期</td>
	                            <td>
	                                <input type="text" value="${map.expireDate}" disabled="disabled" class="text_medium"/>
	                            </td>
	                        </tr>
	                        
	                        <tr>
	                            <td class="bg_gray">新许可证注册</td>
	                            <td>
	                                <input type="text" name="licenseText" id="licenseText" style="width:600px" class="text_medium"/>
	                            </td>
	                        </tr>
                        </tbody>
                    </table>

                    <p><input type="button" onclick="saveLicense()" value="提交">&nbsp;</p>
                </form>
            </div>
            <%--<br/>--%>

            <div class="bg"></div>

            <div id="main-content" class="tablewrapper">
                <table cellpadding="0" cellspacing="0" border="0" class="display" id="orgTbl">

                </table>
            </div>
            <div class="clr"></div>
        </div>
        <div class="clr"></div>
    </div>
</div>

<script type="text/javascript">
	$(function () {
		$("#tabs").tabs();
	});

	function saveLicense() {
		var licenseText = $('#licenseText').val();
    	if(licenseText == null || licenseText == ""){
    		updateTips( " 请输入许可证！ ");
    		return false;
    	}
    	$.post("${ctx}/license/register/save"
                ,$('#licenseForm').serialize()
                ,function(a){
                	if(a == 'N1'){
                		updateTips("保存失败:许可证不可为空.");
                        $("#licenseText").focus();
                        return false;
                	} else if(a == 'N2'){
                		updateTips("保存失败:许可证已经过期.");
                		$("#licenseText").focus();
                        return false;
                	} else {
                    	$("#licenseForm").submit();
                    }
                });
	}

</script>

